Repository navigation
fix(libSceCommonDialog): return ALREADY_SYSTEM_INITIALIZED from a second sceCommonDialogInitialize - #8618
Conversation
|
Title evidence from Windows, for what it's worth: Daxter (PPSA09695, PS5 PSP Classics, Sony's
|
|
Thanks, this is the title evidence the PR was missing, and the disassembly shows the title's SDK code telling the two codes apart. I've put AI-assisted: yes (Claude Code). |
|
Title evidence for this fix: Arkanoid - Eternal Battle (PPSA06327) 01.000.000. Linux 7.2.9, Radeon RX 6650 XT, RADV Mesa 26.2.4, GCC Release. Setup
Result
Candidate at 60 s: 20261021-pr8618-PPSA06327-after-60s.png AI-assisted testing and report: yes, Claude Code. |
…ond sceCommonDialogInitialize A second sceCommonDialogInitialize returned 0x80B80004 (ALREADY_INITIALIZED), the code each dialog's own Initialize returns. The common-dialog system initializer returns 0x80B80002 (ALREADY_SYSTEM_INITIALIZED), as shadPS4 and the SDK error names have it, so callers that accept only SCE_OK or ALREADY_SYSTEM_INITIALIZED treated a second call as a failure. The header keeps ALREADY_INITIALIZED for the dialog libraries that return it. The test pins the literal instead of the header constant, and the debt entry records that a repeated call's value is not measured on a console. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0f2dc38 to
93170e6
Compare
|
Thanks for the Arkanoid run and the bring-up thread. I've put While rebasing I found a problem with the branch as it was. On current Rebased onto The new debt entry conflicts textually with #9623, which adds an AI-assisted: yes (Claude Code). |
What
On
maind6eafa5, a secondsceCommonDialogInitializereturns0x80B80004(Export.cppL12-L18, value inCommonDialog.hppL251). That isSCE_COMMON_DIALOG_ERROR_ALREADY_INITIALIZED, the code a dialog's ownInitializereturns, such assceMsgDialogInitialize.sceCommonDialogInitializeis the common-dialog system initializer under those dialogs, and its second call returnsSCE_COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED,0x80B80002:ALREADY_SYSTEM_INITIALIZEDfromsceCommonDialogInitializeandALREADY_INITIALIZEDfromsceMsgDialogInitialize.commondialog.hdefines them as0x80B80002and0x80B80004.common.hpp:SCE_COMMON_DIALOG_ERROR_ALREADY_INITIALIZEDis0x80b80004andSCE_COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZEDis0x80b80002.CommonDialog.cs:0x80B80002, "A second bring-up returns this rather than failing".0x0, then0x80b80002.Some callers accept only
SCE_OKor the system code. In EA DirtySDK's PS4 source,PrivilegeApiCreatereturns NULL unlesssceCommonDialogInitializereturnsSCE_OKorALREADY_SYSTEM_INITIALIZED, so onmainit fails whenever something in the process initialized the common dialog first.Titles do call it twice. @JJenkx found two:
mainwithFAILED REQUIRE(ret == SCE_OK || ret == SCE_COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED) Could not initialize CommonDialog (80B80004)(comment, Daxter (PPSA09695) #8661). In itseboot.bin, the caller ofsceCommonDialogInitializecompares the result with0x80b80002before testing for0; a second call site accepts0or0x80b80002and handles0x80b80004and0x80b80008separately.main2 s in withuncaught exception 'sceCommonDialogInitialize error, code=0x80b80004' of type Stormancer::PSN::PSNException. With the previous revision of this PR, which returns the same codes as this one, it reaches its mode-select menu (comment, Arkanoid - Eternal Battle (PPSA06327) #9476).8ad0a9897 returned
0x80B80002. #7572 changed it to0x80B80004, and its merge comment checked the value against MsgDialog and PlayerSelectionDialog, whose ownInitializedoes return0x80B80004. A #5852 comment draws the line between the two: "0x80B80004(per-dialog), not0x80B80002, which isALREADY_SYSTEM_INITIALIZED".This change:
COMMON_DIALOG_ERROR_ALREADY_SYSTEM_INITIALIZED(0x80B80002) toCommonDialog.hppand returns it from a secondsceCommonDialogInitialize, instead of fix(libSceCommonDialog): ALREADY_INITIALIZED is 0x80B80004 #7572's0x80B80004.COMMON_DIALOG_ERROR_ALREADY_INITIALIZED(0x80B80004) in the header. Eight of the ten dialog libraries that include the header return it from their ownInitialize; their values stay as they are.compare_exchange_strong.Functionalentry todocs/dev/debt/libSceCommonDialog.md: the value of a repeated call is not measured on a console by the project. The entry lists the sources and notes that a third call is not covered.sceCommonDialogIsUsedstays the silent stub listed indocs/dev/debt/libSceCommonDialog.md. Not measured on a console by me: the hardware log above is a third-party run of two calls on firmware 12.40, and the test's third call is not in it.Tested
Gentoo Linux, kernel 7.2.8, GCC 16.2.1, glibc 2.43, Ninja, Release,
BUILD_TESTING=ON, onmain7e2ba73.guest_common_dialog(core/libs/tests/GuestCommonDialog.cpp) compared the second call with the header constant, so it followed fix(libSceCommonDialog): ALREADY_INITIALIZED is 0x80B80004 #7572. It now pins the literal0x80B80002for the second call and checks that a third call returns it too. ThesceCommonDialogIsUsedchecks are unchanged.Export.cppandCommonDialog.hppfrommainand the library rebuilt, the test aborts at the second call (ctestSubprocess aborted). With this change it passes, 20 runs out of 20.tools/select_tests.pyas CI selects them: 244 passed, 0 failed, 0 skipped. They include the tests of the ten dialog libraries that includeCommonDialog.hpp; eight of those libraries and two of their tests useCOMMON_DIALOG_ERROR_ALREADY_INITIALIZED.tools/check_compile.py --base upstream/main: 2 translation units compile.Export.cpp,GuestCommonDialog.cppand the 20 other files that includeCommonDialog.hpp(ten dialog libraries'Export.cppand their tests) passx86_64-w64-mingw32-g++16.2.0-fsyntax-only -Wall -Wextra. OnlylibSceWebBrowserDialog/Export.cppwarns, with the same two-Wunused-parameterwarnings as withmain's header. This is a syntax check, not a Windows build or run.tools/check_conventions.py --base upstream/mainwith this title and body: all checks passed.tools/pr_overlap.py --branch fix/commondialog-second-init-system-initialized: besides this PR itself, it lists feat(libSceCommonDialog): declare 14 pending exports #9623, which also adds a section afterSilent stubsindocs/dev/debt/libSceCommonDialog.md; whichever merges second keeps both sections (Unknown function info, thenFunctional). No order is agreed with its author yet (asked in this pull request's thread), soDepends onisnone. feat(libSceNpProfileDialog): implement the dialog lifecycle #9152 adds constants afterCOMMON_DIALOG_ERROR_ALREADY_INITIALIZED; the two no longer conflict textually (git merge-tree).sceCommonDialogInitializereturns the same codes:guest_common_dialogpasses; on Linux (RX 6650 XT, RADV) it reaches gameplay together with fix(libSceVideodec2): flush without draining when no picture is pending #8660 (Daxter (PPSA09695) #8661).main38d3c08 plus fix(agc): resolve and render a multisampled target through its sRGB twin format #8847 (an unrelated AGC change) and onlylibSceCommonDialog.prxbuilt frommain38d3c08 with this branch merged, it reaches the mode-select menu and runs for 183 s (Arkanoid - Eternal Battle (PPSA06327) #9476).Not run by me on Windows, macOS or a console.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code